package com.itbaima.mapper;

import com.itbaima.pojo.entity.HrSalary;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper  // 确保添加了 @Mapper 注解
public interface HrSalaryMapper {

    @Select("SELECT name, salary_id, total_salary, allowance, pension_insurance, unemployment_insurance, " +
            "medical_insurance, housing_fund, bonus, dock, hr_salary FROM hrsalary")
    List<HrSalary> getAllHrSalary();


    @Select("SELECT name, salary_id, total_salary, allowance, pension_insurance, unemployment_insurance, " +
            "medical_insurance, housing_fund, bonus, dock, hr_salary FROM hrsalary WHERE department_id = #{departmentId} AND salary_id = #{salaryId}")
    HrSalary getHrSalaryByDepartmentAndSalaryId(@Param("departmentId") Integer departmentId, @Param("salaryId") Integer salaryId);

    @Update("UPDATE hr_salary SET bonus = #{bonus}, dock = #{dock} WHERE name = #{name} AND salary_id = #{salaryId}")
    int updateHrSalary(HrSalary hrSalary);
}
